package com.springcloud.feignconsumer.service;

import com.springcloud.feignconsumer.config.DisableHystrixConfiguration;
import com.springcloud.feignconsumer.entity.User;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;


/**
 * @author AL
 */
//@FeignClient(name = "dp-service",configuration = DisableHystrixConfiguration.class)//禁用hystrix熔断
//指定服务降级类为接口实现类
@FeignClient(name = "hello-service",fallback = HelloServiceFallback.class)
public interface HelloService {
    /**
     * test
     * @return
     */
    @RequestMapping(value = "/api/hello",method = RequestMethod.GET)
    User hello(@RequestParam("username") String username);

    /**
     * test
     * @param name
     * @return
     */
//    @RequestMapping(value = "/api/hello1",method = RequestMethod.GET)
//    String hello(@RequestParam("name") String name);

    /**
     * test
     * @param name
     * @param age
     * @return
     */
    @RequestMapping(value = "/api/hello2",method = RequestMethod.GET)
    User hello(@RequestParam("name") String name, @RequestHeader("age") Integer age);

    /**
     * test
     * @param user
     * @return
     */
    @RequestMapping(value = "/api/hello3",method = RequestMethod.POST)
    String hello(@RequestBody User user);
}
